//
//  KACommonDefine.swift
//  kano
//
//  Created by Sophia on 2024/8/14.
//

import UIKit

let var_smsToast = "Verification code has been sent via SMS to"
let var_voiceToast = "Verification code has been sent via CALL, please answer."


//Personal info
let var_UserIcon = "string_UserIcon"
let var_UserName = "string_Name"
let var_UserFemale = "string_Female"
let var_UserMale = "string_Male"
let var_UserBirthday = "string_Birthday"
let var_UserEmail = "string_Email"
//History
let var_CalculateHistory = "string_CalculateHistory"
//lineChart
let var_LineChart = "string_LineChart"
//Premium
let var_Product = "string_Product"
let var_address = "lendsafecom.com"
//loginstatus
let var_loginStatus = "string_LoginStatus"
let var_changeDevice = "string_changeDeviceLoginStatus"
let var_addressStatus = "string_addressStatus"

//MARK: ------------------

let var_VERSION = (UIDevice.current.systemVersion as NSString).floatValue
let var_CurrentSystemVersion = UIDevice.current.systemVersion

let var_AppVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"]
let var_Version = Bundle.main.infoDictionary?["CFBundleVersion"]

//MARK: ------------------

var var_isPad: Bool {
    (UIDevice.current.userInterfaceIdiom == .pad)
}
let var_isIphone = UIDevice.current.userInterfaceIdiom == .phone
let var_isSimulator = UIDevice.current.model == "iPhone Simulator"

func ka_progressTime(_ type: String) -> String {
    let var_today = Date.ka_string(with: Date())
    return "\(type)\(var_today)"
}

//MARK:  ------------------

func ka_font(size:CGFloat) {
    UIFont.systemFont(ofSize: size)
}

func kFont(_ x:CGFloat) -> UIFont {
    UIFont.systemFont(ofSize: x)
}
func kFontSize(_ x:CGFloat) -> UIFont {
    UIFont.systemFont(ofSize: kscale(x))
}
func kBoldFontSize(_ x:CGFloat) -> UIFont {
    UIFont.boldSystemFont(ofSize: kscale(x))
}


let var_screenWidth = UIScreen.main.bounds.size.width
let var_screenHeight = UIScreen.main.bounds.size.height


let var_isBangsScreen = ka_isBangsScreen()
func ka_isBangsScreen() -> Bool {
    var var_isBangsScreen : Bool = false;
    if #available(iOS 11.0, *) {
        let var_window = UIApplication.shared.windows.first;
        var_isBangsScreen = (var_window?.safeAreaInsets.bottom)! > 0;
    }
    return var_isBangsScreen;
}


let var_statusBarHeight = UIApplication.shared.statusBarFrame.size.height
let var_navBarHeight = UIViewController.ka_currentNavigationController().navigationBar.frame.size.height

let var_safeAreaBottomHeight = var_isBangsScreen ? 34.0 : 0



//6s:375   xr/11:414
func kscale(_ x: CGFloat) -> CGFloat {
//    (kScreenWidth/414.00) * (x)
    //768.00   1024.00
    ((var_screenWidth/(var_isPad ? 768.00 : 414.00)) * (x))
}


let kloc_permit_yes = "sms_service_permission_status"
let kloc_permit_no = "calendar_sync_enabled"

func ka_showPictureView(_ status: Int) -> Bool {
    [1015, 1016, 1617, 1618, 1619, 1014, 1010, 1017, 7006, 7007, 7008].contains(status)
}
